<template>
  <div class="tourist_container">
    <div class="top">
      <div class="left">
        <p>实时游客统计</p>
        <p class="left_bg"></p>
      </div>
      <p class="right">
        可预约总量
        <span>9999</span>
        人
      </p>
    </div>
    <div class="main">
      <div class="main_total">
        <span v-for="(item, index) in people" :key="index">{{ item }}</span>
      </div>
      <div class="charts" ref="charts">123</div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
import * as echarts from "echarts";
// 水球图拓展插件
import "echarts-liquidfill";
let people = ref("245908人");
// 获取节点
let charts = ref();
onMounted(() => {
  let mycharts = echarts.init(charts.value);
  // 设置实例的配置项
  mycharts.setOption({
    // 标题组件
    title: {
      text: "水球图",
    },
    // x|y轴组件
    xAxis: {},
    yAxis: {},
    // 系列:决定你展示什么样的图形图标
    series: {
      type: "liquidFill", // 系列
      data: [0.4, 0.4, 0.2], // 展示的数据
      waveAnimation: true, // 动画
      animationDuration: 2,
      animationDurationUpdate: 0,
      radius: "90%", // 半径
      outline: {
        // 外层边框颜色设置
        show: true,
        borderDistance: 8,
        itemStyle: {
          color: "skyblue",
          borderColor: "#294D99",
          borderWidth: 8,
          shadowBlur: 20,
          shadowColor: "rgba(0, 0, 0, 0.25)",
        },
      },
    },
    //布局组件
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0,
    },
  });
});
</script>

<style scoped lang="scss">
.tourist_container {
  background: url(../../../../assets/images/screen/dataScreen-main-lb.png)
    no-repeat;
  background-size: 100% 100%;

  .top {
    display: flex;
    justify-content: space-between;
    height: 82px;
    padding: 10px;
    color: white;

    .left {
      .left_bg {
        width: 68px;
        height: 8px;
        margin-top: 12px;
        background: url(../../../../assets/images/screen/dataScreen-title.png);
        background-size: 100% 100%;
      }
    }

    .right {
      align-self: flex-end;

      span {
        color: yellowgreen;
        font-size: 12px;
      }
    }
  }

  .main {
    height: calc(100% - 82px);
    padding: 10px;

    .main_total {
      display: flex;

      span {
        margin-left: 6px;
        flex: 1;
        height: 60px;
        text-align: center;
        line-height: 60px;
        background: url(../../../../assets/images/screen/total.png) no-repeat;
        color: #29fcff;
      }

      span:first-child {
        margin-left: 0;
      }
    }

    .charts {
      height: calc(100% - 60px);
      padding-top: 10px;
    }
  }
}
</style>
